home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / RapidLaser.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.0 KB  |  84 lines

  1. class classes.bro.RapidLaser
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var clip;
  8.    var axis;
  9.    var w;
  10.    var h;
  11.    var power;
  12.    var exploX;
  13.    var exploY;
  14.    var xMov = 0;
  15.    var yMov = 0;
  16.    function RapidLaser(px, py, pDir, pid)
  17.    {
  18.       this.x = px;
  19.       this.y = py;
  20.       this.id = pid;
  21.       this.dir = pDir;
  22.       _root.d = _root.d + 1;
  23.       this.clip = _root.attachMovie("rapidLaser","rapidLaser" + this.id + "Clip",_root.d + 5000);
  24.       this.clip._x = this.x;
  25.       this.clip._y = this.y;
  26.       this.clip.id = this.id;
  27.       if(this.dir == "U")
  28.       {
  29.          this.axis = "y";
  30.          this.yMov = -25;
  31.          this.xMov = _root.randRange2(-2,2);
  32.          this.y += 25;
  33.       }
  34.       else if(this.dir == "D")
  35.       {
  36.          this.axis = "y";
  37.          this.yMov = 25;
  38.          this.xMov = _root.randRange2(-2,2);
  39.          this.y -= 25;
  40.       }
  41.       else if(this.dir == "R")
  42.       {
  43.          this.axis = "x";
  44.          this.yMov = _root.randRange2(-2,2);
  45.          this.xMov = 25;
  46.          this.x -= 25;
  47.       }
  48.       else
  49.       {
  50.          this.axis = "x";
  51.          this.yMov = _root.randRange2(-2,2);
  52.          this.xMov = -25;
  53.          this.x += 25;
  54.       }
  55.       this.clip.gotoAndStop(this.dir);
  56.       this.w = this.clip._width;
  57.       this.h = this.clip._height;
  58.       this.power = _root.laserPower;
  59.       if(this.power > 8)
  60.       {
  61.          this.clip.body.gotoAndPlay("boosted");
  62.       }
  63.       _root.stats.fired = _root.stats.fired + 1;
  64.    }
  65.    function hit()
  66.    {
  67.       _root.stats.hit = _root.stats.hit + 1;
  68.       _root.createGunExplo([this.exploX,this.exploY,_root.randRange2(50,80)]);
  69.       _root.removeBroShot("rapidLaser" + this.id);
  70.    }
  71.    function main()
  72.    {
  73.       this[this.axis + "Mov"] *= 1.03;
  74.       if(this.x > 1075 || this.x < -75 || this.y > 675 || this.y < -75)
  75.       {
  76.          _root.removeBroShot("rapidLaser" + this.id);
  77.       }
  78.       this.x += this.xMov;
  79.       this.y += this.yMov;
  80.       this.clip._x = this.x;
  81.       this.clip._y = this.y;
  82.    }
  83. }
  84.